﻿namespace TextFiles
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;

    class ExtractWithoutTheTags
    {
        // 1.2.12.10. Write a program that extracts from given XML file all the text without the tags. Example:
        // <?xml version="1.0"><student><name>Pesho</name>
        // <age>21</age><interests count="3"><interest>
        // Games</instrest><interest>C#</instrest><interest>
        // Java</instrest></interests></student>

        static void Main()
        {
            StreamReader input = new StreamReader(@"../../input.txt", Encoding.GetEncoding("windows-1251"));

            List<char> listy = new List<char>();

            using (input)
            {
                string line = input.ReadLine();
                while (line != null)
                {
                    bool isText = true;
                    for (int i = 0; i < line.Length; i++)
                    {
                        if (line[i] == '<')
                        {
                            isText = false;
                        }
                        else if (line[i] == '>')
                        {
                            isText = true;
                        }
                        else
                        {
                            if (isText == true)
                            {
                                listy.Add(line[i]);
                            }
                            else
                            {
                                continue;
                            }
                        }
                    }

                    line = input.ReadLine();
                }

                Console.WriteLine(String.Join("", listy));
            }
        }
    }
}